
cmake_minimum_required(VERSION 2.6)

project(utilrb)
FIND_PACKAGE(Ruby REQUIRED)

ADD_CUSTOM_TARGET(utilrb_ext ALL
  COMMAND rake
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

STRING(REGEX REPLACE ".*lib(32|64)?/?" "lib/" RUBY_EXTENSIONS_INSTALL_DIR ${RUBY_ARCH_DIR})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib/ DESTINATION ${RUBY_EXTENSIONS_INSTALL_DIR}
  PATTERN "utilrb_ext.*" EXCLUDE )
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ext/ DESTINATION ${RUBY_EXTENSIONS_INSTALL_DIR}
  FILES_MATCHING PATTERN "utilrb_ext.*" 
  PATTERN "*.o" EXCLUDE 
  PATTERN "*.cc" EXCLUDE 
  )
